package com.gpj.sqlbuilder.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * @className PrimaryType
 * @description TODO
 * @author GPJ
 * @date 2020/3/19 11:17
 * @version 1.0
 **/
@Getter
@AllArgsConstructor
public enum PrimaryType {
    NONE("","非主键"),
    INSERT("INSERT","手动设置主键"),
    AUTO("AUTO","自增主键");

    private String code;
    private String name;

    public static PrimaryType getPrimaryType(String code){
        for (PrimaryType value : PrimaryType.values()) {
            if(StringUtils.equals(value.code, code)){
                return value;
            }
        }
        return NONE;
    }
}
